﻿using SAP.Middleware.Connector;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using config = System.Configuration;

namespace WindowsFormsApplication1
{
    public class SapPersistBrokers
    {

       

        private RfcDestination dest;

        public SapPersistBrokers()
        {
            RfcConfigParameters rfcPar = new RfcConfigParameters();

            rfcPar.Add(RfcConfigParameters.Name, config.ConfigurationManager.AppSettings["SapName"]);
            rfcPar.Add(RfcConfigParameters.AppServerHost, config.ConfigurationManager.AppSettings["SapServerHost"]);
            rfcPar.Add(RfcConfigParameters.Client, config.ConfigurationManager.AppSettings["SapClient"]);
            rfcPar.Add(RfcConfigParameters.User, config.ConfigurationManager.AppSettings["SapUser"]);
            rfcPar.Add(RfcConfigParameters.Password, config.ConfigurationManager.AppSettings["SapPassword"]);
            rfcPar.Add(RfcConfigParameters.SystemNumber, config.ConfigurationManager.AppSettings["SapSysnum"]);
            rfcPar.Add(RfcConfigParameters.Language, config.ConfigurationManager.AppSettings["SapLanguage"]);
            dest = RfcDestinationManager.GetDestination(rfcPar);

        }

        public RfcDestination GetRfcDes()
        {
            return dest;
        }
    }
}
